<template>
	<view class="page">
		<!-- 用户信息 -->
		<view class="flex align-center" style="background-color: #ff5039;height: 330rpx;">
			<view class="flex mt-3 mx-3">
				<!-- 头像 -->
				<view class="flex align-center justify-center rounded-circle border" 
				  style="width: 150rpx;height: 150rpx;">
					<image :src="userInfo.avatar||avatar " class="rounded-circle" style="width: 150rpx;height: 150rpx;"></image>
				</view>
				<!-- 昵称 -->
				<view class="flex flex-column justify-center ml-2">
					<text class="font-md text-white">{{userInfo.nickname||'管理员'}}</text>
				</view>
			</view>
		</view>
		<!-- end 用户信息 -->
		<!-- 数据列表 -->
		<view class="flex flex-wrap align-center bg-white py-2 mx-2 rounded" style="margin-top: -30rpx;">
			<view class="flex flex-column align-center" style="width: 170rpx;height: 100rpx;">
				<text class="font text-info"></text>
				<text class="font-md"></text>
			</view>
			<view class="flex flex-column align-center" style="width: 170rpx;height: 100rpx;">
				<text class="font text-info"></text>
				<text class="font-md"></text>
			</view>
			<view class="flex flex-column align-center" style="width: 170rpx;height: 100rpx;">
				<text class="font text-info"></text>
				<text class="font-md"></text>
			</view>
			<view class="flex flex-column align-center" style="width: 170rpx;height: 100rpx;">
				<text class="font text-info"></text>
				<text class="font-md"></text>
			</view>
			<view class="flex flex-column align-center" style="width: 170rpx;height: 100rpx;">
				<text class="font text-info"></text>
				<text class="font-md"></text>
			</view>
			<view class="flex flex-column align-center" style="width: 170rpx;height: 100rpx;">
				<text class="font text-info"></text>
				<text class="font-md"></text>
			</view>
		</view>
		<!-- end 列表 -->
		<view class="mx-2 py-2" style="width: 710rpx;">
			<uni-list>
				<uni-list-item title="关于我们" link to="../about/about" showExtraIcon :extraIcon="{type: 'info'}"></uni-list-item>
				<uni-list-item title="帮助" link showExtraIcon :extraIcon="{type: 'help'}"></uni-list-item>
			</uni-list>
		</view>
		<view class="flex justify-center fixed-bottom mx-2 mb-10" @click="logout">
			<button class="flex justify-center rounded" style="height: 80rpx;width: 100%;background-color: #ff5039;">
				<text class="font text-white">退出</text>
			</button>
		</view>
	</view>
</template>

<script>
	import avatar from '@/static/imgs/admin.png'
	
	export default {
		data() {
			return {
				avatar,
			}
		},
		computed: {
			userInfo() {
				return this.$store.state.userInfo
			},
			userId() {
				return this.$store.getters.userId
			}
		},
		onShow() {
			uni.showTabBar({ animation: true });
		},
		methods: {
			// 登出
			logout() {
				uni.showModal({
					title: '提示',
					content: '是否要退出登陆？',
					cancelText: '不退出',
					confirmText: '退出',
					success: res => {
						if(res.confirm){
							this.$store.commit('logout');
							this.$store.dispatch('logout2');
							uni.reLaunch({ url: '../login/login' })
						}
					},
				});
			}
		}, // end methods
	}
</script>

<style>

</style>
